<template>
	<Layout class="p-5 bg-white">
	  <Form :label-width="80">
	     
	     <Row>
	  	   <Col >
	  		   <FormItem class="w-100" label="标题">
	  		   	<Input type="text" v-model="title" style="width: 500px;"/>
	  		   </FormItem>
			   <FormItem class="w-100" label="联系人">
			   	<Input type="text" v-model="personName" style="width: 500px;"/>
			   </FormItem>
	  		   <FormItem class="w-100" label="电话">
	  		   	<Input type="text" v-model="tel" style="width: 500px;"/>
	  		   </FormItem>
	  		   <FormItem class="w-100" label="微信号">
	  		   	<Input type="text" v-model="wxNumber" style="width: 500px;"/>
	  		   </FormItem>
	  		   <FormItem class="w-100" label="描述">
				   <Input type="textarea" :rows="6" v-model="details" style="width: 500px; height: 150px;"/>
	  		   </FormItem>
	  		   <FormItem >
	  			   
	  				   <Button @click="submit" type="primary">提交</Button>
	  				   <Button @click="cancel" class="ml-2">取消</Button>
	  			 
	  		   </FormItem>
	  	   </Col>
	     </Row>
	    
	  </Form>		
	  
	            </Form> 
	  
	 </Layout>
</template>

<script>
	export default {
		data: function() {
			return {
				clientId:0,
				title : "",
				details : "",
				tel:'',
				wxNumber:'',
				personName:'',
			};
		},
		methods: {
			submit(){
				if (this.$data.title.length == 0) {
					this.message.error("标题必须输入");
					return;
				}
				
				if (this.$data.details.length == 0) {
					this.message.error("描述必须输入");
					return;
				}
				
				let self = this;
				
						this.http.post({
							url: "/car-rent-info/info",
							param: {
								title : self.$data.title,
								details : self.$data.details,
								tel: self.$data.tel,
								wxNumber: self.$data.wxNumber,
								personName:self.$data.personName,
								clientId : self.$data.clientId
							}
						}).then(data => {
							self.message.info("新增成功");
							this.cancel();
						});
					},
					cancel: function() {
						this.$tabs.close();
                        this.$router.push({
                        	name: "carRent",
                        	params: {}
                        });
					}
				},
				created(){
					var cli = this.local.session.getItem("CURRENT");
					this.clientId = cli.client.clientId;
				}
				
			}
			
</script>

<style scoped="scoped">
	div{
		float: left;		
	}
	
	
	
</style>
